package Getenv

import (
	"fmt"
	"github.com/shirou/gopsutil/v3/host"
	"github.com/shirou/gopsutil/v3/mem"
	"os"
)

func GetEnvirenment() {
	value := os.Getenv("PATH")
	if value == "" {
		// 环境变量未设置
	} else {
		// 使用环境变量值
		println(value)
	}
}
func GetHostName() {
	hostname, err := os.Hostname()
	if err != nil {
		fmt.Println("Error:", err)
	} else {
		fmt.Println("Hostname:", hostname)
	}
}

func GetSysCpu() {
	virtMem, _ := mem.VirtualMemory()
	fmt.Printf("Total memory: %v\n", virtMem.Total)
	info, _ := host.Info()
	fmt.Printf("Uptime: %v seconds\n", info.Uptime)
}
